package soul.mq;

public enum  MessageEventType {
    Unknown(0),

    //储值充值, topic_recharge
    ValueCardRechargeEvent(1),
    //红包充值记录, topic_recharge
    RedpackRechargeEvent(2),

    //发送邮件, topic_mail
    SendMailEvent(11),

    //交易查询事件, topic_trans
    TransQueryEvent(21),
    //交易确认事件, topic_trans
    TransConfirmEvent(22),
    //交易取消事件, topic_trans
    TransCancelEvent(23)

    ;

    public static MessageEventType parseType(Integer type) {
        switch (type) {
            case 0:
                return Unknown;
            case 1:
                return ValueCardRechargeEvent;
            case 2:
                return RedpackRechargeEvent;
            case 3:
                return SendMailEvent;
            case 4:
                return TransQueryEvent;
            case 5:
                return TransConfirmEvent;
            case 6:
                return TransCancelEvent;
            default:
                return Unknown;
        }
    }

    private Integer type;

    MessageEventType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return toString();
    }

    public Integer getType() {
        return type;
    }
}
